namespace YuFeng.Repositories.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class Create_Table : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Regions",
                c => new
                    {
                        Id = c.Int(nullable: false),
                        ParentId = c.Int(nullable: false),
                        Name = c.String(maxLength: 32),
                        ShortName = c.String(maxLength: 32),
                        Longitude = c.Single(nullable: false),
                        Latitude = c.Single(nullable: false),
                        Level = c.Int(nullable: false),
                        Sort = c.Int(nullable: false),
                        Status = c.Boolean(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.UserRoles",
                c => new
                    {
                        Id = c.String(nullable: false, maxLength: 128),
                        UserId = c.String(nullable: false, maxLength: 128),
                        RoleId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Users",
                c => new
                    {
                        Id = c.String(nullable: false, maxLength: 128),
                        WechatUserId = c.String(nullable: false, maxLength: 128),
                        Name = c.String(maxLength: 128),
                        Password = c.String(nullable: false, maxLength: 256),
                    })
                .PrimaryKey(t => t.Id);
            
        }
        
        public override void Down()
        {
            DropTable("dbo.Users");
            DropTable("dbo.UserRoles");
            DropTable("dbo.Regions");
        }
    }
}
